
/**
 * This class create objects that are authors of publications.
 * 
 */
public class Author
{
	private final String name, surname;
	/**
	 * Construct an Author object with the specified name and surname.
	 * 
	 * @param name the name of the author.
	 * @param surname the surname of the author.
	 */
    public Author(String name, String surname){
        this.name=name;
        this.surname=surname;
    }
    /**
     * Returns the complete name of the author, name and surname.
     * @return authorName the complete name.
     */
    public String getName() {
    	String authorName = name+" "+surname;
		return authorName;
	}
	@Override
	/**
	 * Returns the String representation of this Author.
	 * 
	 * @return the string representation.
	 */
	public String toString() {
		return  name +" "+ surname ;
	}
	@Override
	/**
	 * Compares this object against the specified object. The result is true if and only if the argument is not null 
	 * and is a Author object that represents the same author of this object. Two author are equals if and only if
	 * name and surname the same strings.
	 * 
	 * @param obj the Object to compare to this against.
	 * @return true if the objects are the same, false otherwise.
	 */
	public boolean equals(Object obj){
        if (this == obj)
            return true;
        if (obj instanceof Author)
        {
            Author other = (Author) obj;
            if (this.name.equals(other.name) && this.surname.equals(other.surname))
                return true;
        }
        return false;
    }
	
}
